package com.epam.diplom.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import com.epam.diplom.bean.Client;
import com.epam.diplom.dao.ClientDao;

@Repository("clientDao")
public class ClientDaoImpl extends HibernateDaoSupport implements ClientDao {

	@Autowired
	public ClientDaoImpl(HibernateTemplate hibernateTemplate) {
		super.setHibernateTemplate(hibernateTemplate);
	}
	
	@SuppressWarnings("unchecked")	
	public List<Client> getClients() {
		DetachedCriteria criteria = DetachedCriteria.forClass(Client.class);
		return getHibernateTemplate().findByCriteria(criteria);
	}

}
